<template>
    <div>
        <ul><li v-for="m in messageList" :key="m.id">
            <router-link :to="{
                name:'xiangqing',
                params:{
                    id:m.id,
                    titel:m.title,
                }
            }">
            {{m.title}}
            </router-link>
            <button @click="pushShow(m)">查看</button>
            <button @click="replaceShow(m)">替换</button>
        </li></ul>
        <hr>
        <router-view></router-view>
    </div>
</template>

<script>
    export default {
        name : "Message",
        data(){
            return {
                messageList:[
                    {id:"001",title:"zzz"},
                    {id:"002",title:"zzz2"},
                ]
            }
        },
        methods:{
            pushShow(m){
                this.$router.push({
                    name:'xiangqing',
                    params:{
                        id:m.id,
                        titel:m.title,
                    }
                })
            },
            replaceShow(m){
                this.$router.replace({
                    name:'xiangqing',
                    params:{
                        id:m.id,
                        titel:m.title,
                    }
                })
            }
        },
    }
</script>